<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8"/>
    <title>Title</title>
</head>
<body>
<h1>Module</h1>
<div th:each="m:${module}">
    <a th:href="${m.mid}" th:text="${m.name}"></a>
</div>

<div class="showPage">
    <a th:each="h:${moduleHref}"  th:text="${h}" class="pageHref"></a>
</div>
</body>
<script th:inline="javascript">
    var moduleIndex = [[${moduleIndex}]];
    var pageCounter = [[${pageCounter}]];
    var pageHref = document.getElementsByClassName('pageHref');
    var sid = [[${sid}]];
    var size = [[${size}]];
    var showPage = document.getElementsByClassName('showPage');
</script>

<script type="text/javascript" th:inline="javascript">
    /*<![CDATA[*/
    for(var i=0;pageCounter>0;pageCounter--,i++){   //直接用i于pageCounter相减有bug,不明原因
        console.log(pageCounter);
        var href = "index?start="+ (i*size + 1) + "&size=" + size;
        pageHref[i].setAttribute("href",href);
    }
    /*]]>*/
</script>
</html>